<?php

namespace humhub\modules\api\models;

use Yii;
use humhub\components\ActiveRecord;
use humhub\modules\user\models\User;

class CourseEpisode extends ActiveRecord
{

    /**
     * @return string the associated database table name
     */
    public static function tableName()
    {
        return 'course_episode';
    }

    /*
     * 返回讲师列表
     */
    public function getTeachers($where){
        $episodes = CourseEpisode::findAll($where);
        $o = [];
        foreach($episodes AS $episode){
            //讲师
            $t = json_decode($episode['teachers'], true);
            if( isset( $t[0]) ){
                $o = array_merge($o, $t);
            }
        }
        return $o;
    }
}
